﻿using System;
using System.Diagnostics;

/// <summary>
/// 单例类基类  
/// </summary>
/// <typeparam name="T"></typeparam>
public class Singleton<T> where T : class, new()
{
    private static T mSingleton;
    public static T GetSingleton()
    {
        return mSingleton ?? (mSingleton = new T());
    }
}

/// <summary>
/// 单例类基类  
/// </summary>
/// <typeparam name="T"></typeparam>
public class Single<T> where T : class, new()
{
    private static T mInstance;
    public static T Instance
    {
        get
        {
            if (mInstance == null)
            {
                mInstance = Activator.CreateInstance<T>();
            }
            return mInstance;
        }
    }
}

/// <summary>
/// 数据初始化
/// </summary>
public interface IBaseData
{
    void Init();
}

public class GameSystemKey
{
    static int id = int.MinValue;
    public static int GenerateID()
    {
        if (id == int.MaxValue)
        {
            Debug.WriteLine("GameSystemKey已达最大值,请检查游戏逻辑");
        }
        id++; return id;
    }
}